	# cn-east-3
import json
import requests
from requests.adapters import HTTPAdapter

session = requests.Session()
session.mount('https://', HTTPAdapter(pool_connections=50, pool_maxsize=100))


url = 'https://iam.cn-north-4.myhuaweicloud.com/v3/auth/tokens'
to = 3
headers = {'Content-Type': 'application/json'}
if not isinstance(headers, dict):
    headers = {'Content-Type': 'application/json'}
kwargs = { 
    "auth": { 
        "identity": { 
            "methods": [ 
                "password" 
            ], 
            "password": { 
                "user": { 
                    "name": "huawei_techhelp_cbs", 
                    "password": "kewosi.2023", 
                    "domain": { 
                        "name": "hw48427504" 
                    } 
                } 
            } 
        }, 
        "scope": { 
            "project": { 
                "name": "cn-north-4" 
            } 
        } 
    } 
}
response = session.post(
    url,
    json=kwargs,
    timeout=to,
    headers=headers
)
res = response.headers
# res = response.json()
# print(json.dumps(res))
print(res['X-Subject-Token'])
token= res['X-Subject-Token']

